
#include <mockcpp/mockcpp.hpp>
#include <testngpp/testngpp.hpp>
#include <Rectangle.h>

USING_MOCKCPP_NS
USING_TESTNGPP_NS

FIXTURE(Rectangle_checkArea)
{
        TEST(check input of width, bigger than max limit, get area 0)
        {
                Rectangle rect(84.123,78.557);
                ASSERT_EQ(0, rect.getArea());
        }

        TEST(check input of width, smaller than min limit, get area 0)
        {
                Rectangle rect(71.334,-2.557);
                ASSERT_EQ(0, rect.getArea());
        }

        TEST(check input of Length, bigger than max limit, get area 0)
        {
                Rectangle rect(101.234,31.557);
                ASSERT_EQ(0, rect.getArea());
        }

        TEST(check input of length, smaller than min limit, get area 0)
        {
                Rectangle rect(-7.265,20.998);
                ASSERT_EQ(0, rect.getArea());
        }

        TEST(check input of length and width, valid input, get area value.)
        {
                Rectangle rect(57.265,50.998);
                ASSERT_EQ(2919.69, rect.getArea());
        }       
};

FIXTURE(Rectangle_checkPerimeter)
{
        TEST(check input of width, bigger than max limit, get perimeter 0)
        {
                Rectangle rect(4.123,78.557);
                ASSERT_EQ(0, rect.getPerimeter());
        }

        TEST(check input of width, smaller than min limit, get perimeter 0)
        {
                Rectangle rect(1.334,-2.557);
                ASSERT_EQ(0, rect.getPerimeter());
        }

        TEST(check input of Length, bigger than max limit, get perimeter 0)
        {
                Rectangle rect(101.234,71.557);
                ASSERT_EQ(0, rect.getPerimeter());
        }

        TEST(check input of length, smaller than min limit, get perimeter 0)
        {
                Rectangle rect(-7.265,50.998);
                ASSERT_EQ(0, rect.getPerimeter());
        }

        TEST(check input of length and width, valid input, get perimeter value)
        {
                Rectangle rect(7.265,50.998);
                ASSERT_EQ(116.5, rect.getPerimeter());
        }
};

FIXTURE(Rectangle_changeShape_checkArea)
{
        TEST(check change Rectangle, and new width bigger than max limit, get area unchanged)
        {
                Rectangle rect(41.123,18.557);
                rect.changeShape(41.123,76.101); 
                ASSERT_EQ(762.78, rect.getArea());
        }

        TEST(check change Rectangle, and new width smaller than min limit, get area unchanged)
        {
                Rectangle rect(41.123,18.557);
                rect.changeShape(41.123,-2.3);
                ASSERT_EQ(762.78, rect.getArea());
        }

        TEST(check change Rectangle, and new length bigger than max limit, get area unchanged)
        {
                Rectangle rect(41.123,18.557);
                rect.changeShape(101.123,18.557);
                ASSERT_EQ(762.78, rect.getArea());
        }

        TEST(check change Rectangle, and new length smaller than min limit, get area unchanged)
        {
                Rectangle rect(41.123,18.557);
                rect.changeShape(-1.123,18.557);
                ASSERT_EQ(762.78, rect.getArea());
        }

        TEST(check change Rectangle, valid input, get new area value)
        {
                Rectangle rect(51.123,28.557);
                rect.changeShape(41.123,18.557);
                ASSERT_EQ(762.78, rect.getArea());
        }
};
